package labox.innovation.gameserver.skills.funcs;

import labox.innovation.gameserver.skills.Env;
import labox.innovation.util.Rnd;

/**
 * @author mkizub
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public final class LambdaRnd extends Lambda {

	private final Lambda _max;
	private final boolean _linear;

	public LambdaRnd(Lambda max, boolean linear)
	{
		_max = max;
		_linear = linear;
	}
	@Override
	public double calc(Env env) {
		if (_linear)
			return _max.calc(env) * Rnd.nextDouble();
        return _max.calc(env) * Rnd.nextGaussian();
	}

}
